package top.dvvj.wheelmall.demo.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.dvvj.wheelmall.common.util.R;

/**
 * 异常处理 Controller
 *
 * @author Dvj
 * @date 2021/9/22 16:34
 */
@RestController
@RequestMapping("exception")
public class ExceptionController {

    @GetMapping("/ex")
    public R<?> exception() throws Exception {
        throw new Exception("Exception");
    }

    @GetMapping("/runtime")
    public R<?> runTimeException() {
        throw new RuntimeException("RunTime Exception");
    }

    @GetMapping("/other")
    public R<?> other() {
        throw new NullPointerException("Other Exception");
    }
}
